package com.ftg.learn.chapter15;

import java.util.*;

/**
 * @author kangjx
 * @createTime 2022/8/24
 */
public class LearnCollections {

    public static void main(String[] args) {
//        Arrays 定长数组
//        Collections
//        List<Integer> list = new ArrayList<>();
//        list.add(23);
//        list.add(2);
//        list.add(45);
//        //Comparator.reverseOrder()
////        Collections.reverseOrder()
//        Collections.sort(list, Comparator.reverseOrder());
//        Collections.sort(list, Integer::compareTo);
//        System.out.println(list);

//
//        //创建一个为空的list
//        List list1 = Collections.emptyList();
//        List list2 = new ArrayList(); //{}
//        System.out.println(list2.get(0));
//
//        list1.get(0);
//        System.out.println(list);
        //Collections.binarySearch(list, 2, (x, y) -> -(x - y)) 没有发现相应的使用场景
//        System.out.println(Collections.binarySearch(list, 2, (x, y) -> -(x - y)));
//        System.out.println(list);
//        Collections.sort(list,(x,y)->-(x-y));
//        System.out.println(list);
//
//
//        System.out.println(list.contains(23));
//
//        System.out.println(Collections.binarySearch(list, 23));

    }

}
